<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class menu_model extends CI_Model {
	var $table = 'jonu_menu';

	public function get_all(){
		$this->db->order_by('jonu_menu_order', 'asc');
		$query = $this->db->get($this->table);
		$result = $query->result_array();

		return $result;
	}

	public function get_by_id($id){
		$this->db->where('jonu_menu_id', $id);
		$query = $this->db->get($this->table);
		$result = $query->result_array();

		return $result;
	}

	public function store($param){
		$data = array(
			'jonu_menu_text' 	=> $param['menu_text'],
			'jonu_menu_link'	=> $param['menu_link'],
			'jonu_menu_order'	=> $param['menu_order']
			);
		$query = $this->db->insert($this->table, $data);

		return $query;
	}

	public function update($param){
		$data = array(
			'jonu_menu_text' 	=> $param['menu_text'],
			'jonu_menu_link'	=> $param['menu_link'],
			'jonu_menu_order'	=> $param['menu_order']
			);
		$this->db->where('jonu_menu_id', $param['menu_id']);
		$query = $this->db->update($this->table, $data);

		return $query;
	}

	public function destroy($id){
		$this->db->where('jonu_menu_id', $id);
		$query = $this->db->delete($this->table);

		return $query;
	}
}

/* End of file menu_model.php */
/* Location: ./application/models/menu_model.php */